<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<title>${appname}-<c:if test="${!empty sessionScope._local_node_session}">${sessionScope._local_node_session.nodeName}-</c:if>${si:ctname("NET_TYPE",sessionScope._netType)}</title>
<%@ include file="/WEB-INF/view/common/css_js_ace.jsp"%>
<link rel="stylesheet" href="${ctx}/static/js/lib/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="${ctx}/static/js/lib/ztree/js/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript" src="${ctx}/static/js/lib/ztree/js/jquery.ztree.excheck-3.5.js"></script>
<script type="text/javascript">
var _rs_image_path = _ctx+"/static/images";

function search(form) {
	$(form).appendPagerParaStr();
	return true;
}

$(function(){
	 if('${param.dcType}'=='1'){
		 $('#dcType_true').removeClass("active");
		 $('#dcType_false').addClass("active");
	 }else{
		 $('#dcType_true').addClass("active");
		 $('#dcType_false').removeClass("active");
	 }
})

	function getInfo(id){
		$.ajax({
			   type: "GET",
			   dataType:"html",
			   cache: false,
			   url: _ctx + "/registry/data_category_get.do",
			   data: {id:id},
			   success: function( content ){
				   $('#data').html( content ); 
				   $('#myModal').modal('show');
			   },
			   error:function(){
				   ui.msg('信息加载错误', 0);
			   }
		});
	}
	
	
	
	function add(){
			$.ajax({
				   type: "GET",
				   dataType:"html",
				   cache: false,
				   url: _ctx + "/registry/data_category_add.do",
				   data: {pid:$("#id").val(),sysId:$("#sysId").val()},
				   success: function( content ){
					   $('#data').html( content ); 
				   },
				   error:function(){
					   ui.msg('信息加载错误', 0);
				   }
			});
	}
	function update(id){
		$.ajax({
			   type: "GET",
			   dataType:"html",
			   cache: false,
			   url: _ctx + "/registry/data_category_update.do",
			   data: {id:id},
			   success: function( content ){
				   $('#data').html( content ); 
			   },
			   error:function(){
				   ui.msg('信息加载错误', 0);
			   }
		});
	}
	function del(id){
			ui.confirm('确认删除?',function(){
				$.ajax({
					   type: "POST",
					   dataType:"json",
					   cache: false,
					   url: _ctx + "/registry/data_category_delete.do",
					   data: {id:id},
					   success: function( resp ){
						   if (resp.status == '1') {
								ui.msg(resp.msg, 1);
								ui.go(_ctx + '/registry/data_category_mgr.do');
							} else {
								ui.msg(resp.msg, 0);
							}
					   },
					   error:function(){
						   $("#del").removeClass("btn-light").addClass("btn-primary").attr("disabled", null);
						   ui.msg('信息加载错误', 0);
					   }
				});
			});	
	}
	
	function menuSync(){
		$.ajax({
			   type: "POST",
			   dataType:"json",
			   cache: false,
			   url: _ctx + "/registry/dataCategory_sync.do",
			   success: function(resp){
				   if(resp.status == '1'){
					   ui.msg(resp.msg, 1);
					   ui.go(_ctx + '/registry/data_category_mgr.do');
				   }else{
					   ui.msg(resp.msg, 0);
				   }
			   },
			   error:function(){
				   ui.msg('信息加载错误', 0);
			   }
		});
	}
	
	
	
	function dataCategoryList(val){
		 $('#dcType').val(val);
		 	if(val=='1'){
				$('#dcType_true').removeClass("active");
				$('#dcType_false').addClass("active");
		 	}else{
		 		$('#dcType_true').addClass("active");
		 	   	$('#dcType_false').removeClass("active");
		 	}
		 	$('#searchForm').submit();
	}
</script>
<style type="text/css">
	div.zTreeDemoBackground {width:auto;height:460px;text-align:left;}
	ul.ztree {margin-top: 10px;border: 1px solid #CCC;height:420px;overflow-y:auto;overflow-x:auto;font-size: 13px;}
	.ztree * {
		padding: 0;
		margin: 0;
		font-size: 13px;
		font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif;
	}
	
	@media only screen and (max-width:992px) {
		.profile-info-name {
			width: 80px
		}
		.profile-info-value {
			margin-left: 90px
		}
		.profile-user-info-striped .profile-info-name {
			position: static;
			width: auto;
			text-align: left;
			padding: 6px 0 6px 10px
		}
		.profile-user-info-striped .profile-info-value {
			margin-left: 10px
		}
	}
	
	@media only screen and (max-width:992px) {
		.user-profile .memberdiv {
			width: 50%;
			margin-left: 0;
			margin-right: 0
		}
	}
</style>
</head>
<body>
<%@ include file="/WEB-INF/view/common/topbar.jsp"%>
<div class="main-container" id="main-container">
	<div class="main-container-inner">
		<%@ include file="/WEB-INF/view/common/sidebar.jsp"%>
		<div class="main-content">
				<div class="breadcrumbs" id="breadcrumbs">
					<ul class="breadcrumb">
						<li>
							<i class="icon-home home-icon"></i>
							<a href="#">首页</a>
						</li>
						<li>
							<a href="#">注册管理</a>
						</li>
						<li>
							<a href="#">数据分类注册</a>
						</li>
						<li class="active">列表</li>
					</ul>
				 </div>
				 <div class="page-content">
				  	<div class="row">
				  		<div class="col-xs-12">
					  		<div class="widget-box">
						  				<div class="widget-header header-color-white">
											<div class="widget-toolbar no-border">
												<c:if test="${sessionScope._user_session.slAuthFlag eq 1 }">
												<c:if test="${!netType}">    <button class="btn btn-primary btn-xs" onclick="return menuSync()" ><i class="icon-refresh bigger-110"></i> 同步到内网&nbsp;&nbsp;</button></c:if>
												</c:if>
												<c:if test="${sessionScope._user_session.slAuthFlag eq 1 || sessionScope._user_session.slAuthFlag eq 2 }">
													<c:if test="${!netType}"><a name="notAdminButton" class="btn btn-primary btn-xs" href="${ctx}/registry/data_category_add.do" ><i class="icon-plus-sign icon-on-right"></i> 注册数据分类&nbsp;&nbsp;</a>
													</c:if>
												</c:if>
											</div>
										</div>
										<div class="widget-body">
											<div class="widget-main">
							  					<form  id="searchForm"  class="form-search"  action="${ctx}/registry/data_category_mgr.do" method="post" onsubmit="return search(this)">
								 					<input type="hidden" name="dcType"  id="dcType" value="${param.dcType}"/>
								 					<div class="row">
													  <div class="col-xs-4">
															<div class="input-group"> 
															   <span class="input-group-addon">数据分类名称：</span> 
																<input type="text" class="form-control"  name="dataName" id="dataName" value="${param.dataName}"/>
															</div>
														</div>
													  <div class="col-xs-4">
														<div class="input-group"> 
														   <span class="input-group-addon">业务域：</span> 
															<select class="form-control form-select" name="domainId">
																<option value="">全部</option>
																<c:forEach var="vo" items="${domain_list}">
																<option value="${vo.id}" <c:if test="${vo.id == param.domainId }">selected</c:if>>${vo.name}(${vo.code})</option>
																</c:forEach>
															</select>
														</div>
													  </div>
								 			 		  <div class="col-xs-4">
						                                    <div class="input-group">
																	<span class="input-group-btn">
																		<button type="submit" class="btn btn-purple btn-sm">
				                                                            <i class="icon-search icon-on-right bigger-110"></i>
				                                                                                                                                                                                          搜索
				                                                        </button>&nbsp;&nbsp;
				                                                        
																		<a href="${ctx}/registry/data_category_mgr.do?dcType=${param.dcType}"
				                                                           class="btn btn-purple btn-sm">
				                                                            <i class="icon-refresh icon-on-right bigger-110"></i>
				                                                                                                                                                                                     清空
				                                                        </a>
																	</span>
							                                    </div>
		                                             </div>
		                                            </div>
												</form>
											</div>
									</div>
								</div>
						  	<div class="hr hr12 hr-dotted"></div>
						  	  <ul class="nav nav-tabs " id="myTab">
								<li id="dcType_true"><a href="javascript:void(0);"
									class="navbar-link" onclick="dataCategoryList('0');">全局数据分类</a>
								</li>
								<li id="dcType_false"><a href="javascript:void(0);"
									class="navbar-link" onclick="dataCategoryList('1');">局部数据分类</a>
								</li>
							</ul>
						  	<div class="table-responsive clearfix">
							<table id="sample-table-1" class="table table-striped table-bordered table-hover">
								<thead>
									<tr>
										<th class="center">序号</th>
										<th>数据分类编码</th>
										<th>数据分类名称</th>
										<th>数据分类类型</th>
										<th>所属业务域</th>
										<th>最后修改时间</th>
										<th>操作</th>
									</tr>
								</thead>

								<tbody>
									<c:forEach var="vo" items="${_data}" varStatus="sta">
									<tr id="${vo.id}"> 
										<td class="center">${sta.count}</td>
										<td>${vo.dataCode }</td>
										<td>${vo.dataName }</td>
										<td>${si:ctname("OBJECT_TYPE",vo.dcType)}</td>
										<td>${vo.domainName}</td>
										<td>${si:fmtDate(vo.mtime)}</td>
										<td>
											<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
											    <a class="blue" href="javascript:void(0);"  onclick="getInfo('${vo.id }');"title="查看">
													<i class="icon-zoom-in bigger-130"></i>
												</a>
												<c:if test="${sessionScope._user_session.slAuthFlag eq 2 }">
													<c:if test='${nodeAdmin eq 1 }'>
														<c:if test='${vo.dcType eq 1 && vo.edit eq 1 }'>
															<a class="green" href="${ctx}/registry/data_category_update.do?id=${vo.id}"  title="修改">
																<i class="icon-pencil bigger-130"></i>
															</a>
															<a class="red" style="display: none;"  href="javascript:void(0);" onclick="del('${vo.id }')" title="删除">
																<i class="icon-trash bigger-130"></i> 
															</a>
														</c:if>
													</c:if>
												</c:if>
												<c:if test="${sessionScope._user_session.slAuthFlag eq 1}">
													<c:if test='${nodeAdmin eq 1 }'>
													<c:if test="${!netType}">
															<a class="green" href="${ctx}/registry/data_category_update.do?id=${vo.id}"  title="修改">
																<i class="icon-pencil bigger-130"></i>
															</a>
															<a class="red" style="display: none;" href="javascript:void(0);" onclick="del('${vo.id }')" title="删除">
																<i class="icon-trash bigger-130"></i> 
															</a>
															</c:if>
													</c:if>
												</c:if>
											</div>
                                        </td>
									</tr>
									</c:forEach>
								</tbody>
							</table>
							<jsp:include page="/WEB-INF/view/common/pg.jsp">
								<jsp:param value="${ctx}/monitor/data_category_mgr.do" name="url"/>
								<jsp:param value="${_total}" name="total"/>
								<jsp:param value="${_urlpara}" name="urlpara" />
							</jsp:include>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<div id="myModal" class="modal fade" role="dialog"  tabindex="-1" aria-labelledby="查看" aria-hidden="false">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
	      </div>
			<div   id="data">
  			</div>
			<div class="modal-footer wizard-actions">
				<button class="btn btn-danger btn-sm pull-left" data-dismiss="modal">
					<i class="icon-remove"></i>
					关闭
				</button>
			</div>
		</div>
	</div>
</div>
</body>
</html>
